Optimal. Leaf size=63 \[ -\left (\left (a^2-b^2\right ) x\right )+\frac {2 a b \log (\cos (c+d x))}{d}-\frac {b^2 \tan (c+d x)}{d}+\frac {(a+b \tan (c+d x))^3}{3 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 63, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 3, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3624, 3558,
3556} \begin {gather*} -x \left (a^2-b^2\right )+\frac {(a+b \tan (c+d x))^3}{3 b d}+\frac {2 a b \log (\cos (c+d x))}{d}-\frac {b^2 \tan (c+d x)}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3558
Rule 3624
Rubi steps
\begin {align*} \int \tan ^2(c+d x) (a+b \tan (c+d x))^2 \, dx &=\frac {(a+b \tan (c+d x))^3}{3 b d}-\int (a+b \tan (c+d x))^2 \, dx\\ &=-\left (a^2-b^2\right ) x-\frac {b^2 \tan (c+d x)}{d}+\frac {(a+b \tan (c+d x))^3}{3 b d}-(2 a b) \int \tan (c+d x) \, dx\\ &=-\left (a^2-b^2\right ) x+\frac {2 a b \log (\cos (c+d x))}{d}-\frac {b^2 \tan (c+d x)}{d}+\frac {(a+b \tan (c+d x))^3}{3 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.32, size = 99, normalized size = 1.57 \begin {gather*} -\frac {a^2 \text {ArcTan}(\tan (c+d x))}{d}+\frac {b^2 \text {ArcTan}(\tan (c+d x))}{d}+\frac {a^2 \tan (c+d x)}{d}-\frac {b^2 \tan (c+d x)}{d}+\frac {b^2 \tan ^3(c+d x)}{3 d}+\frac {a b \left (2 \log (\cos (c+d x))+\tan ^2(c+d x)\right )}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.03, size = 83, normalized size = 1.32
method | result | size |
norman | \(\left (-a^{2}+b^{2}\right ) x +\frac {\left (a^{2}-b^{2}\right ) \tan \left (d x +c \right )}{d}+\frac {a b \left (\tan ^{2}\left (d x +c \right )\right )}{d}+\frac {b^{2} \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}-\frac {a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) | \(80\) |
derivativedivides | \(\frac {\frac {b^{2} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+a b \left (\tan ^{2}\left (d x +c \right )\right )+a^{2} \tan \left (d x +c \right )-b^{2} \tan \left (d x +c \right )-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (-a^{2}+b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(83\) |
default | \(\frac {\frac {b^{2} \left (\tan ^{3}\left (d x +c \right )\right )}{3}+a b \left (\tan ^{2}\left (d x +c \right )\right )+a^{2} \tan \left (d x +c \right )-b^{2} \tan \left (d x +c \right )-a b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )+\left (-a^{2}+b^{2}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{d}\) | \(83\) |
risch | \(-2 i a b x -a^{2} x +b^{2} x -\frac {4 i a b c}{d}+\frac {2 i \left (-6 i a b \,{\mathrm e}^{4 i \left (d x +c \right )}+3 a^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 b^{2} {\mathrm e}^{4 i \left (d x +c \right )}-6 i a b \,{\mathrm e}^{2 i \left (d x +c \right )}+6 a^{2} {\mathrm e}^{2 i \left (d x +c \right )}-6 b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+3 a^{2}-4 b^{2}\right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{3}}+\frac {2 a b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{d}\) | \(161\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.51, size = 78, normalized size = 1.24 \begin {gather*} \frac {b^{2} \tan \left (d x + c\right )^{3} + 3 \, a b \tan \left (d x + c\right )^{2} - 3 \, a b \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 3 \, {\left (a^{2} - b^{2}\right )} {\left (d x + c\right )} + 3 \, {\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.88, size = 77, normalized size = 1.22 \begin {gather*} \frac {b^{2} \tan \left (d x + c\right )^{3} + 3 \, a b \tan \left (d x + c\right )^{2} - 3 \, {\left (a^{2} - b^{2}\right )} d x + 3 \, a b \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) + 3 \, {\left (a^{2} - b^{2}\right )} \tan \left (d x + c\right )}{3 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.11, size = 94, normalized size = 1.49 \begin {gather*} \begin {cases} - a^{2} x + \frac {a^{2} \tan {\left (c + d x \right )}}{d} - \frac {a b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{d} + \frac {a b \tan ^{2}{\left (c + d x \right )}}{d} + b^{2} x + \frac {b^{2} \tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {b^{2} \tan {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} \tan ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 675 vs.
\(2 (61) = 122\).
time = 0.97, size = 675, normalized size = 10.71 \begin {gather*} -\frac {3 \, a^{2} d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, b^{2} d x \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 9 \, a^{2} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 9 \, b^{2} d x \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 3 \, a b \tan \left (d x\right )^{3} \tan \left (c\right )^{3} + 9 \, a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 3 \, a^{2} \tan \left (d x\right )^{3} \tan \left (c\right )^{2} - 3 \, b^{2} \tan \left (d x\right )^{3} \tan \left (c\right )^{2} + 3 \, a^{2} \tan \left (d x\right )^{2} \tan \left (c\right )^{3} - 3 \, b^{2} \tan \left (d x\right )^{2} \tan \left (c\right )^{3} + 9 \, a^{2} d x \tan \left (d x\right ) \tan \left (c\right ) - 9 \, b^{2} d x \tan \left (d x\right ) \tan \left (c\right ) - 3 \, a b \tan \left (d x\right )^{3} \tan \left (c\right ) + 3 \, a b \tan \left (d x\right )^{2} \tan \left (c\right )^{2} - 3 \, a b \tan \left (d x\right ) \tan \left (c\right )^{3} + b^{2} \tan \left (d x\right )^{3} - 9 \, a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) \tan \left (d x\right ) \tan \left (c\right ) - 6 \, a^{2} \tan \left (d x\right )^{2} \tan \left (c\right ) + 9 \, b^{2} \tan \left (d x\right )^{2} \tan \left (c\right ) - 6 \, a^{2} \tan \left (d x\right ) \tan \left (c\right )^{2} + 9 \, b^{2} \tan \left (d x\right ) \tan \left (c\right )^{2} + b^{2} \tan \left (c\right )^{3} - 3 \, a^{2} d x + 3 \, b^{2} d x + 3 \, a b \tan \left (d x\right )^{2} - 3 \, a b \tan \left (d x\right ) \tan \left (c\right ) + 3 \, a b \tan \left (c\right )^{2} + 3 \, a b \log \left (\frac {4 \, {\left (\tan \left (d x\right )^{4} \tan \left (c\right )^{2} - 2 \, \tan \left (d x\right )^{3} \tan \left (c\right ) + \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + \tan \left (d x\right )^{2} - 2 \, \tan \left (d x\right ) \tan \left (c\right ) + 1\right )}}{\tan \left (c\right )^{2} + 1}\right ) + 3 \, a^{2} \tan \left (d x\right ) - 3 \, b^{2} \tan \left (d x\right ) + 3 \, a^{2} \tan \left (c\right ) - 3 \, b^{2} \tan \left (c\right ) + 3 \, a b}{3 \, {\left (d \tan \left (d x\right )^{3} \tan \left (c\right )^{3} - 3 \, d \tan \left (d x\right )^{2} \tan \left (c\right )^{2} + 3 \, d \tan \left (d x\right ) \tan \left (c\right ) - d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.07, size = 108, normalized size = 1.71 \begin {gather*} \frac {b^2\,{\mathrm {tan}\left (c+d\,x\right )}^3}{3\,d}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a^2-b^2\right )}{d}-\frac {\mathrm {atan}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (a+b\right )\,\left (a-b\right )}{a^2-b^2}\right )\,\left (a+b\right )\,\left (a-b\right )}{d}-\frac {a\,b\,\ln \left ({\mathrm {tan}\left (c+d\,x\right )}^2+1\right )}{d}+\frac {a\,b\,{\mathrm {tan}\left (c+d\,x\right )}^2}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________